<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>db</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="dates.html" title="dates" />
    <link rel="next" href="dbamp.html" title="dbamp" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">db</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="dates.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="dbamp.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="db"></a>
      <div class="titlepage"></div>
      <a id="IndexDb" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">db</span>
        </h2>
        <p>db — 
      Returns the amplitude equivalent for a given decibel amount.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp97791184"></a>
        <h2>Description</h2>
        <p>
      Returns the amplitude equivalent for a given decibel amount. This opcode is the same as <a class="link" href="ampdb.html" title="ampdb"><em class="citetitle">ampdb</em></a>.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp97804208"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>db</strong></span>(x)</pre>
        <p>
      This function works at a-rate, i-rate, and k-rate.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp97851264"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>x</em></span> -- a value expressed in decibels.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp97852848"></a>
        <h2>Performance</h2>
        <p>
      Returns the amplitude for a given decibel amount.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp97854112"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the db opcode. It uses the file <a class="ulink" href="examples/db.csd" target="_top"><em class="citetitle">db.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp97855968"></a>
          <p class="title">
            <strong>Example 169. Example of the db opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
-odac     <span class="comment">;;;RT audio out</span>
<span class="comment">;-iadc    ;;;uncomment -iadc if RT audio input is needed too</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o db.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span> <span class="op">=</span> 44100
<span class="ohdr">ksmps</span> <span class="op">=</span> 32
<span class="ohdr">nchnls</span> <span class="op">=</span> 2

<span class="oblock">instr</span> 1

idec <span class="op">=</span> p4
iamp <span class="op">=</span> <span class="opc">db</span>(idec)
     <span class="opc">print</span> iamp
asig <span class="opc">vco2</span> iamp, 110			<span class="comment">;sawtooth</span>
     <span class="opc">outs</span> asig, asig

<span class="oblock">endin</span>

<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span> 1 0 1 50
<span class="stamnt">i</span> 1 + 1 &gt;
<span class="stamnt">i</span> 1 + 1 &gt;
<span class="stamnt">i</span> 1 + 1 85
<span class="stamnt">e</span>

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />

      Its output should include lines like:
</p>
        <pre class="screen">instr 1:  iamp = 316.252
instr 1:  iamp = 1211.582
instr 1:  iamp = 4641.643
instr 1:  iamp = 17782.420</pre>
        <p>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp97861008"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="ampdb.html" title="ampdb"><em class="citetitle">ampdb</em></a>,
      <a class="link" href="cent.html" title="cent"><em class="citetitle">cent</em></a>,
      <a class="link" href="octave.html" title="octave"><em class="citetitle">octave</em></a>,
      <a class="link" href="semitone.html" title="semitone"><em class="citetitle">semitone</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp97866000"></a>
        <p>New in version 4.16</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="dates.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="dbamp.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">dates </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> dbamp</td>
        </tr>
      </table>
    </div>
  </body>
</html>
